<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="./layui/css/layui.css">
<style type="text/css">
body{padding:10px;}
</style>
</head>
<body>

<table class="layui-hide" id="test"></table>

<script type="text/html" id="sex">
{{#  if(d.sex != 1){ }}
    <span>女</span>
{{#  }else{ }}
    <span>男</span>
{{# } }}
</script>


<script type="text/javascript" src="./layui/layui.js"></script>
<script type="text/javascript">
var url = "./json/user.json?v=2";
url = "./php/user.php";
layui.use('table',function(){
    var table = layui.table;
    table.render({
        elem:'#test',
        url:url,
        cellMinWidth:80,
        cols:[[
            {field:'id',width:80,title:'ID',sort:true},
            {field:'username',width:100,title:'用户名'},
            {field:'sex',width:80,title:'性别',templet:'#sex'},
            {field:'sign',width:'30%',minWidth:100,title:'签名'},
            {field:'experience',title:'积分',sort: true},
            {field:'score',title:'积分',sort: true},
            {field:'classify',title:'职业'},
            {field:'wealth',title:'财富',sort: true},
        ]],
        // limit:5, // 配置默认的分页条数
        // page:true, // 开始分页
        page:{
            layout:['limit', 'count', 'prev', 'page', 'next', 'skip'], // 自定义分页布局
            // curr:5,// 设定初始在第5页
            groups:3, //只显示一个页码
            first:false,// 不显示首页
            last:false,// 不显示尾页
        },
    });
});
</script>
</body>
</html>